package com.mnotice.message.informer;


import com.mnotice.common.entity.message.Notification;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public abstract class AbstractInformer implements Informer {
    private String name;


    public void informBefore(Notification notification) {

    }

    public void informAfter(Notification notification) {

    }

    @Override
    public void inform(Notification notification) throws Exception {
        informBefore(notification);
        try {
            informDirect(notification);
        } catch (Exception ignored) {
            processFailed(notification);
        }
        informAfter(notification);
    }
}
